package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @description: 短信发送API类型枚举
 * @Author: hongxiao
 * @date: 2019-01-20 11:32
 */
@Getter
public enum SmsTemplateSendApiEnum {
    /**
     * 短信发送API类型（）
     */
    CHUANG_LAN_MARKET_AMOUNT(0,"enum.smsTemplateSendApi.name.chuang_lan_market_amount"),


    CHUANG_LAN_NOTICE_AMOUNT(1,"enum.smsTemplateSendApi.name.chuang_lan_notice_amount"),


    NEW_MARKET_AMOUNT(2,"enum.smsTemplateSendApi.name.new_market_amount"),


    SPACE_IMAGINATION_NOTICE_AMOUNT(3,"enum.smsTemplateSendApi.name.space_imagination_notice_amount"),


    SPACE_IMAGINATION_MARKET_AMOUNT(4,"enum.smsTemplateSendApi.name.space_imagination_market_amount"),
    ;
    /**
     * 短信发送API类型
     */
    private int code;
    /**
     * 短信发送API名称
     */
    private String name;

    SmsTemplateSendApiEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static SmsTemplateSendApiEnum getByCode(int code) {
        for (SmsTemplateSendApiEnum cacheCode : values()) {
            if (cacheCode.getCode() == code) {
                return cacheCode;
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
